﻿ 
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Entity
{
     

    public class Order : BaseUserEnity
    {

        [Required, MaxLength(50)]
        public string OrderNo { get; set; }
        [MaxLength(50)]
        public string MchId { get; set; }
        public int Fee_typeId { get; set; }  //交易类型 
        public int O_state { get; set; }  //交易状态 
        [MaxLength(30)]
        public string Pay_time { get; set; }  //支付时间 
        [Required]
        public decimal Total_fee { get; set; } //合计金额 
        [Required]
        public decimal Pay_fee { get; set; } //实际支付金额 
        [Required]
        public decimal Get_fee { get; set; } //提现获取金额 
        [Required]
        public decimal Charge_fee { get; set; }  //找零 /
        [Required]
        public decimal Discount_fee { get; set; }  ///优惠减免
        [Required]
        public decimal Promotion_fee { get; set; }  ///优惠减免
        public string Currency { get; set; } //币种 
        public string Remark { get; set; } //备注 
        public string AppId { get; set; } //优惠APPID 
        public string ThirdMchId { get; set; } //支付商户id 
        public string MchName { get; set; } //备注 
        public string Extra { get; set; } //备注 
        public string OpenId { get; set; } //促销活动描述 
        [MaxLength(60)]
        public string TradeNo { get; set; } //支付平台的订单号 
        public OrderType OrderType { get; set; } //订单类型   普通订单，取货吗订单
        public string PayParams { get; set; } //支付参数 
        public int Result { get; set; } //未通知，已通知成功，已通知部分成功，已通知未成功，退款中，退款成功
        public decimal Refund_fee { get; set; } //退款金额
        public string TradeType { get; set; } //交易平台 ，汇聚，钱方好近，支付宝，微信，
        public string MchVerion { get; set; } //程序版本
        public string SN { get; set; } //交易方式
        public bool TransferAble { get; set; } //微信，支付宝手动转账结算 是否结算
        public bool IsTransferSuccess { get; set; } //微信，支付宝手动转账结算 是否结算
        public string TransferId { get; set; } //结算编号
        public string NotifyUrl { get; set; } //微信，支付宝手动转账结算 是否结算 
        public string ParentId { get; set; } //结算用户ID
        /// <summary>
        /// 储存订单掉货检测初始值
        /// </summary>
        public string DropCheckStr { get; set; }
        /// <summary>
        /// 当前订单是否启用了掉货检测  这里的值只用于表示当前订单时间下用户是否设置开启了掉货检测
        /// </summary>
        public bool IsSetDropCheck { get; set; }
        /// <summary>
        /// 上报告知的掉货检测状态 0or1
        /// </summary>
        public int IsDropCheck { get; set; }
        /// <summary>
        /// 当前订单是否通过了检测（无论订单是否开启了掉货检测，这个值只表示了订单交易流程的整体结束状态） 如果存在异常情况，则标记一个true
        /// </summary>
        public bool IsBad { get; set; }
        /// <summary>
        /// 当前订单的掉货检测总数量
        /// </summary>
        public int CheckOutCount { get; set; }
        /// <summary>
        /// 标记一个订单的结束状态
        /// </summary>
        public bool IsEnd { get; set; } 
        public string Details { get; set; } 
        //public string O_Details { get; set; } 
        public string WxTmpMsgNotifyToUserOpenIds { get; set; }
        /// <summary>
        /// 单笔订单聚合成本
        /// </summary>
        public decimal Total_Cost { get; set; }
    }
    public static class TradeType
    {
        public static string AliPay { get; set; } = "AliPay";
        public static string JoinPay { get; set; } = "JoinPay";
        public static string TencentPay { get; set; } = "TencentPay";
        public static string JdPay { get; set; } = "JDPay";
    }
    ////订单支付成功修改模型
    //[Table("Order")]
    //public class OrderPaySuccessUpdateModel :IUpdateEntity
    //{
    //    public string Id { get; set; }
    //    public int O_state { get; set; }
    //    public string Pay_time { get; set; }
    //    public string TradeNo { get; set; }
    //    public string UpdateOn { get; set; }
    //    public string UpdateBy { get; set; }
    //} 
    ////订单支付成功修改模型
    //[Table("Order")]
    //public class OrderSuccessUpdateModel : IUpdateEntity
    //{
    //    public string Id { get; set; }
    //    public string OpenId { get; set; }
    //    public int O_state { get; set; }
    //    public string PayParams { get; set; }
    //    public int Fee_typeId { get; set; }
    //    public string UpdateOn { get; set; }
    //    public string UpdateBy { get; set; }
    //} 
    public enum OrderState
    {
        未处理 = 0,
        待支付 = 1,
        支付成功 = 2,
        退款处理中 = 8,
        退款成功 = 16,
        退款失败 = 32
    }
    public enum Result
    {

         未处理 = 0,
         成功 = 2,
         部分成功 =4,
         出货失败 = 5
    }
    public enum PayType
    { 
        微信 = 100,
        支付宝 = 101,
        现金 = 102,
        支付宝刷脸 = 103,
        其他 = 104
    }
    public enum OrderType
    {  
        购物订单 = 201,
        远程出货 = 202, //远程出货
        取货码订单 = 203,
        游戏抽奖 = 204,
        其他 = 205,
        APP购买 = 206,
        话费充值 = 207,
        IC卡充值 = 208
    }

    public class Refund : BaseUserEnity
    { 
        public string RefundNo { get; set; } 
        public string OrderId { get; set; }

        public decimal Refund_Fee { get; set; }
        public string OpenId { get; set; }

        public string ThirdMchId { get; set; }//收款账户

        public string RefundReason { get; set; }

        public string MchId { get; set; }

        public string TradeNo { get; set; }//支付平台单号 
        public OrderState RefundState { get; set; }
        public string Result { get; set; }//支付平台单号

        public string NotifyUrl { get; set; }//通知地址

    }
}


 